package org.jeecg.enums.base;

/**
 * 房间属性
 */
public enum BaseRoomPropertyEnum {
    BASE_ROOM_PROPERTY_PRIVATE(1, "住宅产权"),
    BASE_ROOM_PROPERTY_BUSINESS(2, "商业产权"),
    BASE_ROOM_PROPERTY_OTHER(3, "其他"),
    ;

    private Integer code;
    private String desc;

    BaseRoomPropertyEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return "";
        BaseRoomPropertyEnum[] enums = values();
        for (BaseRoomPropertyEnum typeEnum : enums) {
            if (value.intValue()  == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        BaseRoomPropertyEnum[] enums = values();
        for (BaseRoomPropertyEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }

}
